#-*-coding:utf-8-*-
import hou

class NetworkEditor_Nodes_andTrees(object):
    def __init__(self):
        super(NetworkEditor_Nodes_andTrees,self).__init__()

    def setNetworkEditor_Animate_Network_Changes(self,bool):
        if bool == True:
            hou.setPreference('networkeditor.showanimations', '1')
            # print('1')
        else:
            hou.setPreference('networkeditor.showanimations', '0')
            # print('0')

    def getNetworkEditor_AnimateNetworkChanges(self):
        return hou.getPreference('networkeditor.showanimations')
        # print('getNetworkEditor_Animate_Network_Changes')


    def setNetworkEditor_NodeInfoWindowsCloseWhenLosingFocus(self):
        if bool == True:
            hou.setPreference('networkeditor.transientinfo','1')
            # print('1')
        else:
            hou.setPreference('networkeditor.transientinfo', '0')
            # print('0')


    def getNetworkEditor_NodeInfoWindowsCloseWhenLosingFocus(self):
        return hou.getPreference('networkeditor.transientinfo')
        # print('getNetworkEditor_NodeInfoWindowsCloseWhenLosingFocus')




    def setNetworkEditor_UseSimplifiedShapeWhen(self,bool):
        if bool == True:
            hou.setPreference('networkeditor.showsimpleshape', '1')
            # print('1')
        else:
            hou.setPreference('networkeditor.showsimpleshape', '0')
            # print('0')


    def getNetworkEditor_UseSimplifiedShapeWhen(self):
        return hou.getPreference('networkeditor.showsimpleshape')
        # print('getNetworkEditor_UseSimplifiedShapeWhen')


    def setNetworkEditor_FlagHotkeysWorkOnExistingNodeSelections(self,bool):
        if bool == True:
            hou.setPreference('networkeditor.flagsallowpreselect', '1')
            # print('1')
        else:
            hou.setPreference('networkeditor.flagsallowpreselect', '0')
            # print('0')

    def getNetworkEditor_FlagHotkeysWorkOnExistingNodeSelections(self):
        return hou.getPreference('networkeditor.flagsallowpreselect')
        # print('getNetworkEditor_FlagHotkeysWorkOnExistingNodeSelections')


    def setNetworkEditor_DisplayVOPInputAndOutputDescriptiveLabels(self,bool):
        if bool == True:
            hou.setPreference('networkeditor.showvopinoutlabels', '1')
            # print('1')
        else:
            hou.setPreference('networkeditor.showvopinoutlabels', '0')
            # print('0')

    def getNetworkEditor_DisplayVOPInputAndOutputDescriptiveLabels(self):
        return hou.getPreference('networkeditor.showvopinoutlabels')
        # print('getNetworkEditor_DisplayVOPInputAndOutputDescriptiveLabels')




    def setNetworkEditor_AllowDivingIntoLockedHDAs(self,bool):
        if bool == True:
            hou.setPreference('networkeditor.allowdiveintohdas', '1')
            # print('1')
        else:
            hou.setPreference('networkeditor.allowdiveintohdas', '0')
            # print('0')

    def getNetworkEditor_AllowDivingIntoLockedHDAs(self):
        return hou.getPreference('networkeditor.allowdiveintohdas')
        # print('getNetworkEditor_AllowDivingIntoLockedHDAs')


    def setNetworkEditor_StackedLookForNodesWithInterestingContents(self,bool):
        if bool == True:
            hou.setPreference('networkeditor.showstackedlook', '1')
            # print('1')
        else:
            hou.setPreference('networkeditor.showstackedlook', '0')
            # print('0')

    def getNetworkEditor_StackedLookForNodesWithInterestingContents(self):
        return hou.getPreference('networkeditor.showstackedlook')
        # print('getNetworkEditor_StackedLookForNodesWithInterestingContents')


    def setNetworkEditor_AutoScrollNetworkWhenDraggingNodes(self,bool):
        if bool == True:
            hou.setPreference('networkeditor.autoscroll', '1')
            # print('1')
        else:
            hou.setPreference('networkeditor.autoscroll', '0')
            # print('0')

    def getNetworkEditor_AutoScrollNetworkWhenDraggingNodes(self):
        return hou.getPreference('networkeditor.autoscroll')
        # print('getNetworkEditor_AutoScrollNetworkWhenDraggingNodes')




    def setNetworkEditor_SnapRadius(self,value):
        hou.setPreference('networkeditor.snapradius',value)
        # print('setNetworkEditor_SnapRadius')

    def getNetworkEditor_SnapRadius(self):
        return hou.getPreference('networkeditor.snapradius')
        # print('getNetworkEditor_SnapRadius')


    def setNetworkEditor_ConnectionSnapRadius(self,value):
        hou.setPreference('networkeditor.connectorsnapradius', value)
        # print('setNetworkEditor_ConnectionSnapRadius')

    def getNetworkEditor_ConnectionSnapRadius(self):
        hou.setPreference('networkeditor.connectorsnapradius')
        # print('getNetworkEditor_ConnectionSnapRadius')


    def setNetworkEditor_DragDistance(self,value):
        hou.setPreference('networkeditor.distancefordrag',value)
        # print('setNetworkEditor_DragDistance')

    def getNetworkEditor_DragDistance(self):
        return hou.getPreference('networkeditor.distancefordrag')
        # print('getNetworkEditor_DragDistance')


    def setNetworkEditor_MinimumNameHeight(self,value):
        hou.setPreference('networkeditor.minnameheight', value)
        # print('setNetworkEditor_MinimumNameHeight')

    def getNetworkEditor_MinimumNameHeight(self):
        return hou.getPreference('networkeditor.minnameheight')
        # print('getNetworkEditor_MinimumNameHeight')


    def setNetworkEditor_MaximumNameHeight(self,value):
        hou.setPreference('networkeditor.maxnameheight', value)
        # print('setNetworkEditor_MaximumNameHeight')

    def getNetworkEditor_MaximumNameHeight(self):
        return hou.getPreference('networkeditor.maxnameheight')
        # print('getNetworkEditor_MaximumNameHeight')



    def setNodeTiles_ShowPreviewsOnNewCOPnodes(self,bool):
        if bool == True:
            hou.setPreference('general.coppreview.val', '1')
            # print('1')
        else:
            hou.setPreference('general.coppreview.val', '0')
            # print('0')

    def getNodeTiles_ShowPreviewsOnNewCOPnodes(self):
        return hou.getPreference('general.coppreview.val')
        # print('getNodeTiles_ShowPreviewsOnNewCOPnodes')


    def setNodeTiles_InitialVOPdetailLevel(self,level):
        '''
        :param levelN:0 - Collapse All Inputs and Outputs,
        1 - Only Show Connected Inputs and Outputs,
        2 - Show all Inputs and Outputs

        :return:
        '''

        hou.setPreference('general.lod.val', str(level))
        # print('Collapse All Inputs and Outputs')

    def getNodeTiles_InitialVOPdetailLevel(self):
        return hou.getPreference('general.lod.val')
        # print('getNodeTiles_InitialVOPdetailLevel')



    def setNodeTiles_IncludePerformanceStaticsInNodeInfo(self,bool):

        if bool == True:
            hou.setPreference('tiles.perfstats.val', '1')
            # print('1')
        else:
            hou.setPreference('tiles.perfstats.val', '0')
            # print('0')

    def getNodeTiles_IncludePerformanceStaticsInNodeInfo(self):
        return hou.getPreference('tiles.perfstats.val')
        # print('getNodeTiles_IncludePerformanceStaticsInNodeInfo')



    def setOperatorTreeViews_DisplayIconInOperatorTreeViewsByDefault(self,bool):

        if bool == True:
            hou.setPreference('trees.displayicons.val', '0')
            # print('1')
        else:
            hou.setPreference('trees.displayicons.val', '0')
            # print('0')

    def getOperatorTreeViews_DisplayIconInOperatorTreeViewsByDefault(self):
        return hou.getPreference('trees.displayicons.val')
        # print('getOperatorTreeViews_DisplayIconInOperatorTreeViewsByDefault')


    def setParameterPane(self,bool):

        if bool == True:
            hou.setPreference('parmdialog.embedviseditor.val', '1')
            # print('1')
        else:
            hou.setPreference('parmdialog.embedviseditor.val', '0')
            # print('0')

    def getParameterPane(self):
        return hou.getPreference('parmdialog.embedviseditor.val')
        # print('getParameterPane')


